#include "StdAfx.h"
#include "TcpManager.h"

TcpManager::TcpManager(void)
{
}

void TcpManager::Connect( String^ server, Int32 port)
{

	client = gcnew TcpClient( server,port );


	// Get a client stream for reading and writing.
	//  Stream stream = client->GetStream();

	stream = client->GetStream();

}


void TcpManager::SendFrame()
{
	
	float kawasaki[8];
	unsigned char* data_buf = (unsigned char*)kawasaki;

	array<Byte>^data = gcnew array<Byte>(8*sizeof(float));

	for (int i=0; i<8*sizeof(float); i++)
	{
		data[i]=data_buf[i];
	}

	
	stream->Write(data, 0, data->Length );

	Console::WriteLine( "Sent: {0}", data->Length );


}

void TcpManager::Disconnect()
{

	// Close everything.
	client->Close();

}